package com.fjut.dao.daotest;

import com.fjut.dao.UserDao;
import com.fjut.pojo.User;
import com.fjut.service.UserService;
import org.apache.log4j.Logger;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Service;

import java.util.List;

public class UserDaoTest {
    private Logger logger= Logger.getLogger(UserDaoTest.class);
    ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring-config.xml");
    UserService userService = (UserService) applicationContext.getBean("userService");

    @Test
    public void Test3(){
        List<User> users = null;

        try{
            users = userService.select("","");
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            for (User user:users){
                logger.info(user);
            }
        }
    }
}
